import "./scroll-view.uniapp-sfc.css";
import { computed, defineComponent } from "vue";
import { createNamespace, transformSize, transformStyleSize } from "../utils";
import { scrollViewProps, scrollViewEmits } from "./helper";
const __vue_sfc__ = defineComponent({
  name: createNamespace("ScrollView")[0],
  options: {
    // https://uniapp.dcloud.io/matter.html#mp
    virtualHost: true
  },
  props: scrollViewProps,
  emits: scrollViewEmits,
  setup(props) {
    const theStyle = computed(() => {
      const { customStyle, width, height, maxHeight, scrollX, enableFlex } = props;
      let style = "";
      if (width)
        style += `width:${transformSize(width)};`;
      if (height)
        style += `height:${transformSize(height)};`;
      if (maxHeight)
        style += `max-height:${transformSize(maxHeight)};`;
      if (scrollX)
        style += `white-space:nowrap;`;
      if (enableFlex)
        style += "display:flex;";
      return transformStyleSize(customStyle) + style;
    });
    return { theStyle };
  }
});
import { renderSlot as _renderSlot, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, withCtx as _withCtx, createBlock as _createBlock } from "vue";
const _hoisted_1 = {
  key: 0,
  class: "fan-scroll-view--flexin"
};
function __vue_render__(_ctx, _cache) {
  const _component_scroll_view = _resolveComponent("scroll-view");
  return !_ctx.scrollable && _ctx.enableFlex ? (_openBlock(), _createElementBlock(
    "div",
    {
      key: 0,
      class: "fan-scroll-view fan-scroll-view--flex",
      style: _normalizeStyle(_ctx.theStyle)
    },
    [
      _renderSlot(_ctx.$slots, "default")
    ],
    4
    /* STYLE */
  )) : (_openBlock(), _createBlock(_component_scroll_view, {
    key: 1,
    class: "fan-scroll-view",
    style: _normalizeStyle(_ctx.theStyle),
    "scroll-x": _ctx.scrollX,
    "scroll-y": _ctx.scrollY,
    "scroll-with-animation": _ctx.scrollWithAnimation,
    "enable-back-to-top": _ctx.enableBackToTop,
    "upper-threshold": _ctx.upperThreshold,
    "lower-threshold": _ctx.lowerThreshold,
    "scroll-top": _ctx.scrollTop,
    "scroll-left": _ctx.scrollLeft,
    "enable-flex": _ctx.enableFlex,
    "show-scrollbar": false,
    onScroll: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("scroll", $event)),
    onScrolltolower: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("scrolltolower")),
    onScrolltoupper: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("scrolltoupper"))
  }, {
    default: _withCtx(() => [
      _ctx.enableFlex && _ctx.scrollX && _ctx.scrollable ? (_openBlock(), _createElementBlock("div", _hoisted_1, [
        _renderSlot(_ctx.$slots, "default")
      ])) : _renderSlot(_ctx.$slots, "default", { key: 1 })
    ]),
    _: 3
    /* FORWARDED */
  }, 8, ["style", "scroll-x", "scroll-y", "scroll-with-animation", "enable-back-to-top", "upper-threshold", "lower-threshold", "scroll-top", "scroll-left", "enable-flex"]));
}
__vue_sfc__.render = __vue_render__;
var stdin_default = __vue_sfc__;
export {
  stdin_default as default
};
